//
//  OrderCell.m
//  cm
//
//  Created by suyibaishan on 2017/11/7.
//  Copyright © 2017年 feihu. All rights reserved.
//

#import "OrderCell.h"

@implementation OrderCell
{
    UILabel *priceLabel;
    UILabel *dateLabel;
}
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self constructUI];
    }
    return self;
}

-(void)constructUI
{
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = [UIColor colorWithRed:0.96 green:0.96 blue:0.96 alpha:1];
    [self.contentView addSubview:line];
    line.sd_layout
    .leftSpaceToView(self.contentView, 0)
    .topSpaceToView(self.contentView, 0)
    .widthIs(kScreenWidth)
    .heightIs(1);
    
    priceLabel = [[UILabel alloc]init];
//    priceLabel.text = [NSString stringWithFormat:@"金额：¥9.00"];
    priceLabel.textColor = [UIColor blackColor];
    priceLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:priceLabel];
    priceLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(line, 5)
    .widthIs(kScreenWidth - 30)
    .heightIs(25);

    dateLabel = [[UILabel alloc]init];
//    dateLabel.text = [NSString stringWithFormat:@"日期：2017-1-1 12:12"];
    dateLabel.textColor = [UIColor blackColor];
    dateLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:dateLabel];
    dateLabel.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(priceLabel, 0)
    .widthIs(kScreenWidth - 100)
    .heightIs(25);
}

-(void)setModel:(OrderModel *)model
{
    _model = model;
    priceLabel.text = [NSString stringWithFormat:@"首付金额：¥%.2f  实付金额：¥%.2f",model.payAmount,model.price];
    dateLabel.text = [NSString stringWithFormat:@"日期：%@",model.createTime];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
